﻿using System;
using System.Collections.Generic;
using SharpTrainer.Util;
using Zeus.Thunder.Core;

namespace SharpTrainer.Collections
{
    class LinkedListTest : ITestCase
    {
        public void Run()
        {
            var lst = new LinkedList<string>();
            var elem1 = lst.AddFirst("isn’t");
            var elem2 = lst.AddBefore(elem1, "This");
            var elem3 = lst.AddAfter(elem1, "a");
            var elem4 = lst.AddLast("list");
            var elem5 = lst.AddBefore(elem4, "singly");
            var elem6 = lst.AddAfter(elem5, "linked");
            Display(lst);

            lst.Last.Previous.Previous.Value = "doubly";
            lst.First.Next.Value = "is";
            Display(lst);
        }

        private void Display(LinkedList<string> lst)
        {
            GenericUtil<string>.PrintLinkedList(lst);
        }
    }
}
